import React, { Component,PureComponent } from 'react'
import Son1 from './components/Son1';
import Son2 from './components/Son2';
/**
 * PureComponent: 
 * 状态数据-state 没有改变，不会重新render 渲染
 * 外部数据-props 没有改变，不会重新render 渲染
 * 
 */
export default class App extends PureComponent {
    state = {
        count:10
    }
    render() {
        console.log('App render');
        let {count} = this.state
        return (
            <div>
                <p>App state count: {count}</p>
                <p><button onClick={()=>{
                    this.setState({
                        count:count + 1
                    })
                }}>count++</button></p>

                <p><button onClick={()=>{
                    this.setState({
                        count:100
                    })
                }}>count = 100</button></p>

                <hr />
                <Son1 count={count}/>
                <Son2/>
            </div>
        )
    }
}
